package com.yuxi.service.impl;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.yuxi.modelExt.BannerExt;
import com.yuxi.dao.IBannerDao;
import com.yuxi.searchExt.BannerSearchExt;
import com.yuxi.pubInter.IBaseDao;
import com.yuxi.pubInter.AbstractBaseService;
import com.yuxi.service.IBannerService;
import lombok.extern.slf4j.Slf4j;
import com.yuxi.common.StringUtil;
import com.yuxi.common.SkList;
import com.yuxi.pubInter.exception.SkException;

import java.util.List;


/**
*    @author sunke
*    @Date 2023-10-13 10:05:02
*    @description BannerService      广告图
*/
@Service(value = "bannerService")
@Slf4j
public class BannerServiceImpl extends AbstractBaseService<BannerExt, BannerSearchExt,String> implements IBannerService {

    @Resource(name = "bannerDao")
    private IBannerDao bannerDao;

    @Override
    public IBaseDao<BannerExt, BannerSearchExt,String> getDao() {
        return bannerDao;
    }


    /**
     * @param positionFlag
     * @param size
     * @return
     */
    @Override
    public List<BannerExt> getListByPositionFlagAndSize(int positionFlag, int size) {
        try {
            BannerSearchExt search=BannerSearchExt.getInstance();
            search.setPositionFlagIn(SkList.getInstance().addObjToList(positionFlag));
            search.setPageSize(size);
            search.setOrderBy("b_sort_num");
            return getList(search);
        } catch (SkException e) {

        }
        return null;


    }
}